<?php
function theme_setup() {
	add_theme_support( 'menus' );
	register_nav_menus( array(
	'top_menu' => 'Top Menu',
	'category_menu' => 'Category Menu'
	) );
	add_theme_support( 'post-thumbnails' );
	set_post_thumbnail_size( 870, 9999 ); // Unlimited height, soft crop


}
add_action( 'after_setup_theme', 'theme_setup' );

function get_meta_values( $key , $quantity=5) {
    global $wpdb;
    if( empty( $key ) )
        return;

    $r = $wpdb->get_col( $wpdb->prepare( "
        SELECT post_id FROM {$wpdb->postmeta} 
        WHERE meta_key = '%s'
        AND meta_value > 0 
        LIMIT 0, %d
    ", $key.'_count', $quantity ) );
    return $r;
}

function get_content_images() {
    $content = get_the_content();
    preg_match_all( '/<img[^>]+>/i', $content, $result); 
    return $result[ 0 ];
}

require_once( "bornrich-redirects.php" );